package main

import "sort"

func singleNumber(nums []int) int {
	sort.Ints(nums)
	val := nums[0]
	count := 0
	for _, v := range nums {
		if v == val {
			count++
		} else {
			if count < 3 {
				return val
			}
			val = v
			count = 1
		}
	}
	return val
}

func main() {
	nums := []int{2, 2, 3, 2, 3, 3, 4}
	println(singleNumber(nums))
}
